﻿Public Class SharedItemDetailsControl
    Public Sub UpdateView(ByVal item As Entities.SharedItem, ByVal files As Generic.List(Of Entities.SharedItemFile))
        txtItemName.Text = item.Name
        txtDirectory.Text = item.Directory
        txtGroupMode.Text = item.GroupMode.ToString
        txtItemType.Text = item.ItemType.ToString
        txtUniqueId.Text = item.UniqueId
        txtAdded.Text = item.Added.ToLocalTime.ToString("g")
        txtLastChanged.Text = item.LastChanged.ToLocalTime.ToString("g")

        txtTotalFiles.Text = item.TotalFiles.ToString
        txtTotalSize.Text = Framework.Misc.ToReadableFileSize(item.TotalSize)

        lvwFiles.BeginUpdate()
        lvwFiles.Items.Clear()
        For Each clsFile As Entities.SharedItemFile In files
            With lvwFiles.Items.Add(clsFile.FileName)
                .SubItems.Add(Framework.Misc.ToReadableFileSize(clsFile.Size))
                .SubItems.Add(clsFile.Added.ToLocalTime.ToString("g"))
                .SubItems.Add(clsFile.LastChanged.ToLocalTime.ToString("g"))
                .SubItems.Add(clsFile.Directory)
                .SubItems.Add(clsFile.SHA512Hash)
                .Tag = clsFile
            End With
        Next
        lvwFiles.EndUpdate()

    End Sub

End Class
